# 編寫異步任務代碼
#異步任務包
from celery_tasks.sms.yuntongxun.sms import CCP
from celery_tasks.sms import constants
from celery_tasks.main import celery_app

@celery_app.task(name='send_sms_code') # 使用裝飾器註冊任務
def send_sms_code(mobile,sms_code):
    """
    發送短信的celery異步任務
    :param mobile:手機號
    :param sms_code: 驗證碼
    :return:
    """
    CCP().send_template_sms(mobile, [sms_code, constants.SMS_CODE_REDIS_EXPIRES // 60], 1)
